import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/major_hazard/hazard_curve_entity.dart';

HazardCurveEntity $HazardCurveEntityFromJson(Map<String, dynamic> json) {
  final HazardCurveEntity hazardCurveEntity = HazardCurveEntity();
  final String? lastCollectTime = jsonConvert.convert<String>(json['lastCollectTime']);
  if (lastCollectTime != null) {
    hazardCurveEntity.lastCollectTime = lastCollectTime;
  }
  final double? lastValue = jsonConvert.convert<double>(json['lastValue']);
  if (lastValue != null) {
    hazardCurveEntity.lastValue = lastValue;
  }
  final String? targetCode = jsonConvert.convert<String>(json['targetCode']);
  if (targetCode != null) {
    hazardCurveEntity.targetCode = targetCode;
  }
  final String? targetStatus = jsonConvert.convert<String>(json['targetStatus']);
  if (targetStatus != null) {
    hazardCurveEntity.targetStatus = targetStatus;
  }
  final String? targetTypeDicId = jsonConvert.convert<String>(json['targetTypeDicId']);
  if (targetTypeDicId != null) {
    hazardCurveEntity.targetTypeDicId = targetTypeDicId;
  }
  final String? targetTypeDicName = jsonConvert.convert<String>(json['targetTypeDicName']);
  if (targetTypeDicName != null) {
    hazardCurveEntity.targetTypeDicName = targetTypeDicName;
  }
  final String? unit = jsonConvert.convert<String>(json['unit']);
  if (unit != null) {
    hazardCurveEntity.unit = unit;
  }
  return hazardCurveEntity;
}

Map<String, dynamic> $HazardCurveEntityToJson(HazardCurveEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['lastCollectTime'] = entity.lastCollectTime;
  data['lastValue'] = entity.lastValue;
  data['targetCode'] = entity.targetCode;
  data['targetStatus'] = entity.targetStatus;
  data['targetTypeDicId'] = entity.targetTypeDicId;
  data['targetTypeDicName'] = entity.targetTypeDicName;
  data['unit'] = entity.unit;
  return data;
}

extension HazardCurveEntityExtension on HazardCurveEntity {
  HazardCurveEntity copyWith({
    String? lastCollectTime,
    double? lastValue,
    String? targetCode,
    String? targetStatus,
    String? targetTypeDicId,
    String? targetTypeDicName,
    String? unit,
  }) {
    return HazardCurveEntity()
      ..lastCollectTime = lastCollectTime ?? this.lastCollectTime
      ..lastValue = lastValue ?? this.lastValue
      ..targetCode = targetCode ?? this.targetCode
      ..targetStatus = targetStatus ?? this.targetStatus
      ..targetTypeDicId = targetTypeDicId ?? this.targetTypeDicId
      ..targetTypeDicName = targetTypeDicName ?? this.targetTypeDicName
      ..unit = unit ?? this.unit;
  }
}
